<!DOCTYPE html>
<!--
To change this license header, choose License Headers in Project Properties.
To change this template file, choose Tools | Templates
and open the template in the editor.
-->
<html>
    <head>
        <meta charset="UTF-8">
        <title></title>
    </head>
    <body>
        <?php
        // put your code here
        include ("../conn/conn.php");
        $conn = prepare();
        ?>
        <?php
	   $stmt = exectue_sql_statement($conn, "select count(*) as total from Users");
	   $info = sqlsrv_fetch_array($stmt);
           $total = $info['total'];
	   if($total == 0) {
	     echo "本站暂无管理员!";
	   }else{
?>
<form name="form1" method="post" action="deleteadmin.php">
  <p>&nbsp;</p>
  <table width="750" border="0" align="center" cellpadding="0" cellspacing="0">
  <tr>
    <td height="75" bgcolor="#666666"><table width="750" height="86" border="0" cellpadding="0" cellspacing="1">
      
	  <tr bgcolor="#FFCF60">
        <td height="20" colspan="10" bgcolor="#B0E0E6"><div align="center">管理员信息管理</div></td>
      </tr>
      <tr>
        <td width="59" height="28" bgcolor="#FFFFFF"><div align="center">复选</div></td>
        <td width="102" bgcolor="#FFFFFF"><div align="center">登录名</div></td>
        <td width="86" bgcolor="#FFFFFF"><div align="center">性别</div></td>
        <td width="79" bgcolor="#FFFFFF"><div align="center">年龄</div></td>
        <td width="75" bgcolor="#FFFFFF"><div align="center">联系方式</div></td>
      </tr>
	  <?php
	  
	       $pagesize=10;
		   if ($total<=$pagesize){
		      $pagecount=1;
			} 
			if(($total%$pagesize)!=0){
			   $pagecount=intval($total/$pagesize)+1;
			
			}else{
			   $pagecount=$total/$pagesize;
			
			}
			if((@$_GET['page'])==""){//实在不知道怎么去掉那个可恶的Notice了
			    $page=1;
			
			}else{
			    $page=intval($_GET['page']);
			
			}
			 
           $stmt = exectue_sql_statement($conn, "select top $pagesize ".
                                                "users_id, users_name, users_sex, users_age, users_tel ".
                                                "from Users ".
                                                "where users_id not in ".
                                                "(select top ".($page-1)*$pagesize." users_id from Users) ");
		   while($info1=sqlsrv_fetch_array($stmt))
		    {
	  ?>
      <tr>
        <td height="25" bgcolor="#FFFFFF"><div align="center">
          <input type="checkbox" name="<?php echo $info1['users_id'];?>" value=<?php echo $info1['users_id'];?>>
        </div></td>
        <td height="25" bgcolor="#FFFFFF"><div align="center"><?php echo $info1['users_name'];?></div></td>
        <td height="25" bgcolor="#FFFFFF"><div align="center"><?php echo $info1['users_sex'];?></div></td>
        <td height="25" bgcolor="#FFFFFF"><div align="center"><?php echo $info1['users_age'];?></div></td>
        <td height="25" bgcolor="#FFFFFF"><div align="center"><?php echo $info1['users_tel'];?></div></td>
      </tr>
	 <?php
	    }
      ?>
	 
    </table></td>
  </tr>
</table>
<table width="750" height="25" border="0" align="center" cellpadding="0" cellspacing="0">
  <tr>
    <td width="165">
	  <div align="left"><input name="submit" type="submit"id="submit" value="删除选择">
	  &nbsp;<input type="reset" value="重新选择"></div></td>
    <td width="585"><div align="right">&nbsp;本站共有管理员
        <?php
		   echo $total;
		  ?>
        &nbsp;位&nbsp;每页显示&nbsp;<?php echo $pagesize;?>&nbsp;位&nbsp;第&nbsp;<?php echo $page;?>&nbsp;页/共&nbsp;<?php echo $pagecount; ?>&nbsp;页
        <?php
		  if($page>=2)
		  {
		  ?>
        <a href="showadmin.php?page=1" title="首页"><font face="webdings"> 9 </font></a> <a href="showadmin.php?id=<?php echo $id;?>&page=<?php echo $page-1;?>" title="前一页"><font face="webdings"> 7 </font></a>
        <?php
		  }
		   if($pagecount<=4){
		    for($i=1;$i<=$pagecount;$i++){
		  ?>
        <a href="showadmin.php?page=<?php echo $i;?>"><?php echo $i;?></a>
        <?php
		     }
		   }else{
		   for($i=1;$i<=4;$i++){	 
		  ?>
        <a href="showadmin.php?page=<?php echo $i;?>"><?php echo $i;?></a>
        <?php }?>
        <a href="showadmin.php?page=<?php echo $page-1;?>" title="后一页"><font face="webdings"> 8 </font></a> <a href="showadmin.php?id=<?php echo $id;?>&page=<?php echo $pagecount;?>" title="尾页"><font face="webdings"> : </font></a>
        <?php }?>
    </div></td>
  </tr>
</table>
<p>&nbsp;</p>
</form>
  <?php
	}
  ?>
    </body>
</html>
